package com.opmsys.result;

import lombok.Data;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@Data
public class VisiteDeny {
    public VisiteDeny(HttpServletResponse response, String msg) throws IOException {
        String json = "{\n" +
                "\t\"msg\": \""+msg+"！\",\n" +
                "\t\"code\": -1,\n" +
                "\t\"data\": null\n" +
                "}";
        //返回结果
        response.setContentType("application/json");
        response.setCharacterEncoding("UTF-8");
        // 获取PrintWriter对象
        PrintWriter out = response.getWriter();
        out.print(json);
        // 释放PrintWriter对象
        out.flush();
        out.close();
    }
}
